cb.define(process.env.__DOMAINKEY__, function() {
    var Request_Utils = {
        createProxy: function(url, method, options = { domainKey: process.env.__DOMAINKEY__ }) {
            options.domainKey = process.env.__DOMAINKEY__
            let proxy = cb.rest.DynamicProxy.create({
                doProxy: {
                    url: url,
                    method: method,
                    options: options
                }
            });
            return proxy;
        },
        doPost: function(url, data, callback, option = { domainKey: process.env.__DOMAINKEY__ } ) {
            option.domainKey = process.env.__DOMAINKEY__
            let proxy = cb.rest.DynamicProxy.create({
                doProxy: {
                    url: url,
                    method: "POST",
                    options: option
                }
            });
            return proxy.doProxy(data, callback);
        },
        // 同步请求
        doPostSync: function(url, data) {
            let proxy = cb.rest.DynamicProxy.create({
                doProxy: {
                    url: url,
                    method: "POST",
                    options: {
                        mask: true,
                        async: false,
                        domainKey: process.env.__DOMAINKEY__
                    }
                }
            });
            return proxy.doProxy(data, null);
        },
        // 同步请求
        doGetSync: function(url, data) {
            let proxy = cb.rest.DynamicProxy.create({
                doProxy: {
                    url: url,
                    method: "GET",
                    options: {
                        mask: true,
                        async: false,
                        domainKey: process.env.__DOMAINKEY__
                    }
                }
            });
            return proxy.doProxy(data, null);
        },
        doGet: function(url, data, callback, option = { domainKey: process.env.__DOMAINKEY__ }) {
            option.domainKey = process.env.__DOMAINKEY__
            let proxy = cb.rest.DynamicProxy.create({
                doProxy: {
                    url: url,
                    method: "GET",
                    options: option
                }
            });
            return proxy.doProxy(data, callback);
        }
    };

    try {
        module.exports = Request_Utils;
    } catch (error) {
        console.log(error);
    }
    return Request_Utils;
});